package cn.xredman.struts2;

import com.opensymphony.xwork2.ActionContext;

public class LoginAction {

	private String username;
	private String password;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	//处理用户请求的excute方法
	public String execute() throws Exception {
		if(getUsername().equals("xredman")) {
			ActionContext.getContext().getSession().put("user",username);
			return "success";
		} else {
			return "error";
		}
	}
}
